package com.google.android.location.content.maps.colors;


import com.google.android.location.content.Constants;
import com.google.android.locatiom.maps.myroutes.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

import static com.google.android.location.content.Constants.*;

/**
 * A factory for TrackPathPainters.
 *
 * @author Andrei
 */
public class RoutePathPainterFactory {

  private RoutePathPainterFactory() {
  }

  /**
   * Get a new RoutePathPainter.
   * @param context Context to fetch system preferences.
   * @return The RoutePathPainter that corresponds to the route color mode setting.
   */
  public static RoutePathPainter getRoutePathPainter(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(
        Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
    if (prefs == null) {
      return new SingleColorRoutePathPainter(context);
    }
    
    String colorMode = prefs.getString(context.getString(R.string.route_color_mode_key), null);
    Log.i(TAG, "Creating route path painter of type: " + colorMode);
    colorMode = null;
    return new SingleColorRoutePathPainter(context);
 }
}